package com.example.mvcdemo.mapper;

import com.example.mvcdemo.model.MessageInfo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Li_yizYa
 * Date: 2025/7/16
 * Time: 16:24
 */
@Mapper
public interface MessageInfoMapper {
    /**
     * 查询所有留言
     */
    @Select("select * from message_info where delete_flag=0")
    List<MessageInfo> queryMessage();

    /**
     * 插入留言信息
     */
    @Insert("insert into message_info (`from`, `to`, `message`) values (#{from}, #{to}, #{message})")
    void insertMessage(MessageInfo messageInfo);
}
